let resolve;
let reject;
var promise = new Promise(function (_resolve_, _reject_) {
resolve = _resolve_;
reject = _reject_;
});
promise
This file contains hidden or 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
fn main() { | |
let i: u64 = 0xDEADBEEFCAFEBABE; | |
let b1: u8 = ( i & 0x00000000000000FF) as u8; | |
let b2: u8 = ((i >> 8) & 0x00000000000000FF) as u8; | |
let b3: u8 = ((i >> 16) & 0x00000000000000FF) as u8; | |
let b4: u8 = ((i >> 24) & 0x00000000000000FF) as u8; | |
let b5: u8 = ((i >> 32) & 0x00000000000000FF) as u8; | |
let b6: u8 = ((i >> 40) & 0x00000000000000FF) as u8; | |
let b7: u8 = ((i >> 48) & 0x00000000000000FF) as u8; | |
let b8: u8 = ((i >> 56) & 0x00000000000000FF) as u8; |
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <fcntl.h> | |
#include <unistd.h> | |
#include <inttypes.h> | |
#include <ctype.h> | |
#define BUF_LEN 16384 |
This file contains hidden or 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
// Inspired by http://viewsourcecode.org/snaptoken/kilo/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <termios.h> | |
#include <ctype.h> | |
struct termios orig_termios; | |
void unsetupTerminal() { |
This file contains hidden or 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
// Constant compilation: | |
// echo editor.c | entr bash -c "echo "-----------------" && cc -ggdb3 editor.c -o /tmp/editor && echo OK" | |
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <termios.h> | |
#include <unistd.h> | |
#include <errno.h> | |
#include <string.h> | |
#include <sys/ioctl.h> |
This file contains hidden or 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/bash | |
function pb_init() { | |
# define the progress bar size (in characters) | |
PROGRESS_BAR_SIZE=20 | |
# Hide the cursor | |
printf "\033[?25l" | |
# Show cursor on exit | |
trap 'printf "\033[?25h"' 0 | |
} |
This file contains hidden or 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/bash | |
# With some help from | |
# https://unix.stackexchange.com/questions/198590/what-is-a-bind-mount?newreg=977065634e454f7eaf4ec14c024033cf | |
set -e | |
function usage() { | |
echo "usage: jail folder" | |
echo "Create and launch a jail in the provided folder" | |
} |
This file contains hidden or 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
> // By default, functions are applied to the window object | |
> function foo() { this.bar = 42; }; | |
> foo(); | |
> window.bar; | |
42 | |
> // window properties are globals in the browser | |
> bar | |
42 | |
> delete window.bar | |
> bar |
This file contains hidden or 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
# From https://security.stackexchange.com/a/20539/148521 | |
# On the server | |
nc -l -k localhost 9000 | |
# On the client | |
ssh -f -L 10000:127.0.0.1:9999 [email protected] sleep 1; nc localhost 10000 | |
# To send every character | |
stty -icanon && ssh -f -L 10000:127.0.0.1:9999 [email protected] sleep 1; nc localhost 10000 |
This file contains hidden or 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
cat some_filename | \ # Open the file | |
tr [:blank:] '\n' | \ # transform whitespace into new line | |
tr '[:upper:]' '[:lower:]' | \ # Shift to lower case | |
sed 's/^[[:punct:]]*\([a-z]*\)[[:punct:]]*$/\1/g' | \ # Remove punctuation before and after words | |
grep '^[a-z]*$' | \ # Remove words containing punctuation | |
sort | \ # Sort | |
uniq -c | \ # Count | |
sort -rn | \ # Sort the count | |
less |
OlderNewer