This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -I$JAVA_HOME/include -I$JAVA_HOME/include/linux jsizes.c -o jsizes && ./jsizes | |
#include <stdio.h> | |
#include <jni.h> | |
int main() { | |
printf("jboolean %li\n", sizeof (jboolean)); | |
printf("jbyte %li\n", sizeof (jbyte)); | |
printf("jchar %li\n", sizeof (jchar)); | |
printf("jshort %li\n", sizeof (jshort)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[string] $Filter, | |
[switch] $Recurse, | |
[int] $Top | |
) | |
function main { | |
Get-ChildItem -Recurse:$Recurse -Filter $Filter | | |
where { -not (Test-Path $_ -PathType Container) } | | |
Measure-Lines | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -I$JAVA_HOME/include -I$JAVA_HOME/include/linux jsizes.c -o jsizes && ./jsizes | |
#include <stdio.h> | |
#include <jni.h> | |
int main() { | |
printf("jboolean %li\n", sizeof (jboolean)); | |
printf("jbyte %li\n", sizeof (jbyte)); | |
printf("jchar %li\n", sizeof (jchar)); | |
printf("jshort %li\n", sizeof (jshort)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once( dirname(__FILE__) . '/wp-load.php' ); | |
require_once( ABSPATH . WPINC . '/registration.php' ); | |
require_once( ABSPATH . '/wp-includes/pluggable.php' ); | |
require_once( ABSPATH . '/wp-includes/general-template.php' ); | |
require_once( ABSPATH . '/wp-includes/capabilities.php' ); | |
if ($_POST) { | |
if ($user = get_userdatabylogin($_REQUEST['username'])) { // FIXME: doesn't work | |
wp_update_user(array("ID" => $user->ID, "user_pass" => $_REQUEST['password'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-WebFile { | |
param( | |
[Parameter(Mandatory=$true)] | |
$Uri, | |
[string] $OutFile, | |
[string] $Hash, | |
[string] $HashAlgorithm = 'SHA256' | |
) | |
if (-not $OutFile) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Compute-Sha256($Str) { | |
$sha256 = New-Object System.Security.Cryptography.SHA256Managed | |
$sha256.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($Str)) | |
} | |
function Get-RandomBytes($Size) { | |
$rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider | |
$bytes = [System.Byte[]]::new($Size) | |
$rng.GetBytes($bytes) | |
$bytes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function d(str) { | |
console.log(hexdump(decode(str))); | |
} | |
function decode(base64) { | |
base64 = base64 || ''; | |
return atob(base64.replace(/_/g, '/').replace(/-/g, '+')); | |
} | |
function hexdump(buffer, blockSize) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "| Name | Partition | Size (kB) | Path | Type |" | |
echo "|------|-----------|-----------|------|------|" | |
for d in /dev/block/bootdevice/by-name/*; do | |
name=$(basename -- "$d") | |
device=$(basename "$(readlink -- "$d")") | |
read -r _ fsmount fstype _ <<EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
class UserNotFound(Exception): pass | |
### Windows ### | |
if os.name == 'nt': | |
import ctypes | |
from ctypes import windll, wintypes | |
class WinError: # [1] |