Skip to content

Instantly share code, notes, and snippets.

View saveroo's full-sized avatar

Muhammad Surga Savero saveroo

View GitHub Profile
@saveroo
saveroo / 0_reuse_code.js
Created February 3, 2014 18:37
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
PsAPI; //Add this to "uses"
function GetModuleBaseAddress(ProcessID: Cardinal; MName: String): Pointer;
var
Modules : Array of HMODULE;
cbNeeded, i : Cardinal;
ModuleInfo : TModuleInfo;
ModuleName : Array[0..MAX_PATH] of Char;
PHandle : THandle;
begin
@saveroo
saveroo / Poking_MultiLevel.pas
Created February 4, 2014 00:29
Poking Multilevel Pointer
procedure Poke2Pointer_NoEdit(Address: DWORD; offset1: integer;
offset2: integer; isi: extended)stdcall;
var
BaseAddress: integer;
AddressBuffer: DWORD;
PokingValue: single;
HW: HWND;
op: THandle;
pcID: integer;
(*
DLL Injection in delphi :)
Tested on 32bit and 64Bit application
coded by Behrooz Abbassi (ME !)
*)
function InjectDLL(const dwPID: DWORD; {$IFDEF UNICODE} DLLPath: PWideChar
@saveroo
saveroo / bukatripdb.skema
Created November 12, 2015 13:57
laravel db design
[{"name":"bt_user","color":"Red","position":{"x":155,"y":136},"increment":false,"timestamp":false,"softdelete":false,"column":[{"name":"userid","type":"increments","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c230","order":0},{"name":"fullname","type":"string","length":"25","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c240","order":1},{"name":"username","type":"string","length":"15","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c254","order":2},{"name":"password","type":"string","length":"20","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"v
[{"name":"bt_user","color":"Red","position":{"x":160,"y":129},"increment":false,"timestamp":false,"softdelete":false,"column":[{"name":"userid","type":"increments","length":"","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c230","order":0},{"name":"fullname","type":"string","length":"25","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c240","order":1},{"name":"username","type":"string","length":"15","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"visible":false,"hidden":false,"colid":"c254","order":2},{"name":"password","type":"string","length":"20","defaultvalue":"","enumvalue":"","ai":false,"pk":false,"nu":false,"ui":false,"in":false,"un":false,"fillable":false,"guarded":false,"v
import React, { PropTypes } from 'react';
function render(props) {
if (typeof props.children === 'function') {
return props.children();
}
return props.children || null;
}
#!/usr/bin/php -q
<?php
/**
* Created by IntelliJ IDEA.
* User: saveroo
* Date: 10/12/16
* Time: 1:20
*/
@saveroo
saveroo / distinguish.sh
Last active October 25, 2017 19:43
Rubocop SH
for cop in `rubocop --show-cops | egrep -o "^\w[^:]+" `; do if ! grep -q $cop ok_cops; then echo `rubocop --only $cop | grep $cop | wc -l` $cop >> bad_cops; fi; done
@saveroo
saveroo / multiternary.rb
Created December 19, 2016 07:10
multiternary
@units = Unit.where(id: @unit_discount.map(&:unit_id) + @search.result.pluck(:unit_id) +
(params[:q].present? ? AvailabilityFact.where(vendor_id: @vendor.id)
.all_unit_inventory_at(Date.new(params[:q]['valid_date_gteq(1i)'].to_i, params[:q]['valid_date_gteq(2i)'].to_i, params[:q]['valid_date_gteq(3i)'].to_i),
Date.new(params[:q]['valid_date_lteq(1i)'].to_i, params[:q]['valid_date_lteq(2i)'].to_i, params[:q]['valid_date_lteq(3i)'].to_i)).pluck(:unit_id) : []))
.where { id << hidden_unit }.includes(:stock, variant: :product).joins(variant: :product).order('products.name ASC').page(params[:page]).per_page(50)
if params[:q]