Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Fuitad's full-sized avatar

Pierre-Luc Brunet Fuitad

  • Montreal, Quebec, Canada
View GitHub Profile
#sample found by @JohnLaTwc
#$WebPostTimer = 1200
#$WebGetTimer = 1200
[void] [Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
[void] [Reflection.Assembly]::LoadWithPartialName("System.Drawing")
function New-Mutex($MutexName) {
#[CmdletBinding()][OutputType([PSObject])]
#Param ([Parameter(Mandatory)][ValidateNotNullOrEmpty()][string]$MutexName)
@Fuitad
Fuitad / battle.php
Last active September 24, 2017 23:48
Fighting enemies
<?php
foreach ($roundData->getEnemy() as $enemy) {
//30% chance to attack a buddy
$enemyHp = $enemy->getHp();
while ($enemyHp > 0) {
if (rand(1, 100) <= 30) {
/** @var \FfrkCentral\Ffrk\Models\Battle\Buddy $randomBuddyToDamage */
$randomBuddyToDamage = $battleData->getBuddy()[array_rand($battleData->getBuddy())];
@Fuitad
Fuitad / unpacker.php
Created September 24, 2017 18:30
FFRK JS unpacker
<?php
if (count($argv) <= 1) {
exit();
}
array_shift($argv);
foreach ($argv as $jsFile) {
if (!file_exists($jsFile)) {
@Fuitad
Fuitad / scramble.rb
Created September 6, 2016 19:06 — forked from araipiyo/scramble.rb
def trim(v)
v & 0xffffffff
end
def scramble(v)
v ^= 0x1ca7bc5b
v *= 0x1ca7bc5b
v = trim(v)
v = ((v >> 1) & 0x55555555) | trim((v & 0x55555555) << 1)
@Fuitad
Fuitad / laravel.js
Last active May 28, 2016 16:05 — forked from fer-ri/laravel.js
You use Laravel 5 and you want to send a DELETE request without creating a form? This will handle the form-creation bits for you dynamically, similar to the Rails implementation. To use, import script, and create a link with the `data-method="DELETE"` attribute. Make sure you also add the proper <meta> tags in the <head> section of your HTML pag…
/*
* Original code: Jeffrey Way (https://gist.github.com/JeffreyWay/5112282)
* Modified for Laravel 5 and to use closure: soufiane EL HAMCHI (https://gist.github.com/soufianeEL/3f8483f0f3dc9e3ec5d9)
* and Ferri Sutanto (https://gist.github.com/ghprod/0bb7f8d207ba7838a0e6)
* Uses meta csrfToken and meta csrfParam based on: https://github.com/rails/jquery-ujs/blob/master/src/rails.js
*
* Examples :
* <a href="posts/2" data-method="delete">
* - Or, request confirmation in the process -
* <a href="posts/2" data-method="delete" data-confirm="Are you sure?">
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
@Fuitad
Fuitad / utilSinceDB.sh
Last active February 19, 2019 11:52 — forked from yesnault/utilSinceDB.sh
#!/bin/bash
#
#
# Usage
# This script do nothing, it juste show files that are scanned or not by
# Logstash and plugin File. 3 outputs
#
# ./utilSinceDB.sh
# ./utilSinceDB.sh | grep "not found in sincedb"
# ./utilSinceDB.sh | grep "to delete"
@Fuitad
Fuitad / gist:1368444
Created November 15, 2011 21:37
Jade debugging
debug> run
debugger listening on port 5858connecting... ok
breakpoint #1 in #<Object>.[anonymous](exports=#<Object>, require=function require(path) {
return Module._load(path, self);
}, module=#<Module>, __filename=/Volumes/Fuitad/Documents/www/app.js, __dirname=/Volumes/Fuitad/Documents/www), /Volumes/Fuitad/Documents/www/app.js:1
(function (exports, require, module, __filename, __dirname) { var conf = require('./conf'),
^
debug> continue
debug> Express server listening on port 3000 in development mode
break in [anonymous](req=#<IncomingMessage>, res=#<ServerResponse>, function callbacks(err) {
- (TTStyle*)imageThumbView:(UIControlState)state {
TTBoxStyle* boxStyle = [TTBoxStyle styleWithMargin:UIEdgeInsetsMake(4, 4, 4, 4) next:nil];
TTStyle* imageStyle = [TTImageStyle styleWithImageURL:nil
defaultImage:nil
contentMode:UIViewContentModeScaleAspectFit
size:CGSizeZero next:boxStyle];
TTPartStyle* imagePart = [TTPartStyle styleWithName:@"image" style:imageStyle next:nil];
TTStyle* contentStyle = [TTContentStyle styleWithNext:imagePart];
TTStyle* fillStyle = [TTSolidFillStyle styleWithColor:hexColor(0xcccccc) next:contentStyle];
TTStyle* whiteBorder = [TTSolidBorderStyle styleWithColor:hexColor(0xffffff) width:2 next:fillStyle];