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
local fd = vim.loop.fs_scandir(vim.fn.stdpath('config') .. '/lua/user/') | |
for name in | |
function() return vim.loop.fs_scandir_next(fd) end | |
do require('user.' .. name:gsub('.lua\z', '')) end |
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 Foundation | |
import AppKit | |
class AppDelegate: NSObject, NSApplicationDelegate { | |
func applicationDidFinishLaunching(_ notification: Notification) { | |
DistributedNotificationCenter.default.addObserver( | |
forName: Notification.Name("AppleInterfaceThemeChangedNotification"), | |
object: nil, queue: nil, | |
using: self.themeChanged(notification:) | |
) |
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
@[Link(ldflags: "-lpq -I`pg_config --includedir` -L`pg_config --libdir`")] | |
lib LibPQ | |
fun connect = PQconnectdb(conninfo : UInt8*) : Void* | |
fun exec = PQexec(conn : Void*, query : UInt8*) : Void* | |
fun getvalue = PQgetvalue(res : Void*, row : Int32, column : Int32) : UInt8* | |
end | |
conn = LibPQ.connect("postgres:///") | |
res = LibPQ.exec(conn, "select 'Hello it is ' || now()") | |
String.new(LibPQ.getvalue(res, 0, 0)) #=> "Hello it is 2015-07-15 16:30:44.396092-07" |
SameSite=strict
cookies is another layer to help prevent CSRF attacts in newer browsers
(at least 5, no clue about earlier versions)
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
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
SELECT | |
n.nspname as "Schema", | |
c.relname as "Name", | |
a.attname, | |
pg_catalog.format_type(a.atttypid, a.atttypmod), | |
a.attrelid as table_id, | |
(SELECT c.collname FROM pg_catalog.pg_collation c, pg_catalog.pg_type t | |
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation) AS attcollation | |
FROM pg_catalog.pg_class c | |
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |
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
# on remote machine | |
# nc -l -p 1212 | |
# on local machine | |
ssh = Net::SSH.start(remote.ip, "centos", keys_only: true, key_data: [remote.ssh_key]) | |
tempfile = Tempfile.new("net_ssh_forward_test") | |
path = tempfile.path | |
tempfile.delete |
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
/t/test> cat a.cr | |
def go | |
a = 0 | |
10.times do | |
a += 1 | |
end | |
p a | |
end |
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
class ExpMovingStats | |
def initialize(@alpha : Float32) | |
@mean = 0.0 | |
@variance = 0.0 | |
end | |
def update(n) | |
n = n.to_f32 | |
beta = 1.0 - @alpha |
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
http://github.com/FiloSottile/age | |
~> ./Downloads/age/age-keygen > key | |
Warning: writing to a world-readable file. | |
Consider setting the umask to 066 and trying again. | |
Public key: age1gnf3ahtvwhtpdc47jtec6t7nn2n2rrxla7wfk9kswvep66ypk5sqgz6f04 | |
~> cat key | |
# created: 2020-05-29T23:02:29-07:00 | |
# public key: age1gnf3ahtvwhtpdc47jtec6t7nn2n2rrxla7wfk9kswvep66ypk5sqgz6f04 | |
AGE-SECRET-KEY-1N2DZHD52AGASHWJAMNVFQJGHVR9FZF77NVNVPRXTEPECZ7YD3MDQXKERX6 |