Skip to content

Instantly share code, notes, and snippets.

LDI 1
STA 15
LDI 0
OUT
ADD 15
JC 7
JMP 3
SUB 15
OUT
JZ 3
@yarysh
yarysh / one_light.itermcolors
Created March 26, 2024 08:46
One Light theme for iTerm2
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@yarysh
yarysh / main.go
Created November 20, 2023 17:44
How do slices grow in Go
package main
import "fmt"
func main() {
initLen, insertions := 64, 1024*10
s := make([]int, 0, initLen)
currCap := cap(s)
@yarysh
yarysh / main.go
Created August 20, 2021 08:11
Wrong mmapSize will return for ARM64
package main
import (
"fmt"
"reflect"
"unsafe"
"golang.org/x/sys/unix"
)
@yarysh
yarysh / ip6tables-rules
Created November 24, 2019 13:41
/etc/network/if-up.d/ip6tables-rules
#!/sbin/ip6tables-restore
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Разрешаем связанные и установленые соединения
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# Разрешаем служебный icmp-трафик
@yarysh
yarysh / iptables-rules
Created November 24, 2019 13:40
/etc/network/if-up.d/iptables-rules
#!/sbin/iptables-restore
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# Разрешаем связанные и установленые соединения
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
# Разрешаем служебный icmp-трафик
@yarysh
yarysh / multiValChart.html
Last active December 25, 2015 12:19
AmStock chart with multiple value axes
<!-- This demo on jsfiddle http://jsfiddle.net/Yarysh/zguCJ/2/ -->
<!DOCTYPE html>
<html>
<head>
<style>
body{
font-size:12px;
color:#000000;
background-color:#ffffff;
@yarysh
yarysh / csrf.js
Created July 10, 2013 11:42
[AngularJS] Include CSRF token to all POST request
angular.module('myApp').run(['$http', '$cookies', function ($http, $cookies) {
$http.defaults.headers.post['X-CSRFToken'] = $cookies.csrftoken;
}]);
@yarysh
yarysh / root.py
Created June 8, 2013 10:21
Get path to folder in django project
#Usage: TEMPLATES_DIR = root('templates')
from os.path import join, abspath, dirname
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
@yarysh
yarysh / addClass.js
Created June 5, 2013 11:10
addClass function for JavaScript
function addClass(o, c){
var re = new RegExp("(^|\\s)" + c + "(\\s|$)", "g");
if (re.test(o.className)) return;
o.className = (o.className + " " + c).replace(/\s+/g, " ").replace(/(^ | $)/g, "");
}