Skip to content

Instantly share code, notes, and snippets.

View srghma's full-sized avatar

Serhii Khoma srghma.github.io/how-life-was-created srghma

View GitHub Profile
@Icelandjack
Icelandjack / Yoneda.markdown
Last active February 10, 2023 00:06
Yoneda
import Data.Functor.Yoneda
import Data.Char
import Data.Kind

infixr 5
  ·

type  List :: (Type -> Type) -> Constraint
class List f where
@srghma
srghma / MindTrash.md
Last active October 10, 2022 09:54
MindTrash

How to debug sublime plugins:

  • install rpdb through pip
  • import rpdb; rpdb.set_trace()
  • telnet 127.0.0.1 4444

Разница между CSRF (Cross-Site Request Forgery) и XSS (Cross-Site Scripting)

Оба - атака на пользователя, в отличие от SQL Injection (атака на сервер)

XSS:
  • цель - заставить браузер жертв(ы) исполнить код
@jewelsea
jewelsea / H2app.java
Created February 14, 2013 19:32
Sample for accessing a local database from JavaFX.
import java.sql.*;
import java.util.logging.*;
import javafx.application.Application;
import javafx.collections.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.stage.Stage;

I have been an aggressive Kubernetes evangelist over the last few years. It has been the hammer with which I have approached almost all my deployments, and the one tool I have mentioned (shoved down clients throats) in almost all my foremost communications with clients, and it was my go to choice when I was mocking my first startup (saharacluster.com).

A few weeks ago Docker 1.13 was released and I was tasked with replicating a client's Kubernetes deployment on Swarm, more specifically testing running compose on Swarm.

And it was a dream!

All our apps were already dockerised and all I had to do was make a few modificatons to an existing compose file that I had used for testing before prior said deployment on Kubernetes.

And, with the ease with which I was able to expose our endpoints, manage volumes, handle networking, deploy and tear down the setup. I in all honesty see no reason to not use Swarm. No mission-critical feature, or incredibly convenient really nice to have feature in Kubernetes that I'm go

@NicolasT
NicolasT / Primes.hs
Created August 1, 2011 14:14
Simple Haskell implementation of the Paillier homomorphic encryption scheme
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
-- Stuff taken from the RSA module for now
module Primes where
import Data.Bits
import Data.Int
import Data.Word
import Data.ByteString.Lazy (ByteString)
@EspadaV8
EspadaV8 / gist:1357237
Created November 11, 2011 05:04
Script to import Geonames into PostgreSQL taken from http://forum.geonames.org/gforum/posts/list/15/926.page
#!/bin/bash
#===============================================================================
#
# FILE: getgeo.sh
#
# USAGE: ./getgeo.sh
#
# DESCRIPTION: run the script so that the geodata will be downloaded and inserted into your
# database
#
@terenceponce
terenceponce / profile_management_spec.rb
Last active July 13, 2020 02:22
Creating Signed Cookies in Capybara
# spec/features/profile_management_spec.rb
require 'rails_helper'
feature 'Profile Management', type: :feature do
given!(:user) { create(:user) }
scenario 'User updates profile' do
cookie = SignedCookieGenerator.new(:auth, user.id)
page.driver.browser.set_cookie(cookie.to_s)
" turn all symbols into unicode or back
autocmd FileType purescript map <buffer> <silent> <leader>hu :%s/ => / ⇒ /ge<CR>:%s/ -> / → /ge<CR>:%s/ <- / ← /ge<CR>:%s/ :: / ∷ /ge<CR>:%s/ <= / ⇐ /ge<CR>:%s/ forall / ∀ /ge<CR>
autocmd FileType purescript map <buffer> <silent> <leader>hU :%s/⇒/=>/ge<CR>:%s/→/->/ge<CR>:%s/←/<-/ge<CR>:%s/∷/::/ge<CR>:%s/⇐/<=/ge<CR>:%s/∀/forall/ge<CR>
" convert symbols while typing
autocmd FileType purescript iab forall ∀
autocmd FileType purescript iab -> →
autocmd FileType purescript iab <- ←
@0sc
0sc / aws-go+docker-setup.sh
Last active September 10, 2019 12:15
Setup script for golang, docker and docker-compose on Amazon Linux AMI 2017.09.0 (HVM) on EC2
#!bin/sh
# Update installed packages and package cache
sudo yum update -y
# make sure in the home folder
cd ~/
# Golang installation
@bigardone
bigardone / plugin.coffee
Created August 8, 2013 06:58
CoffeeScript jQuery plugin template
# Note that when compiling with coffeescript, the plugin is wrapped in another
# anonymous function. We do not need to pass in undefined as well, since
# coffeescript uses (void 0) instead.
do ($ = jQuery, window, document) ->
# window and document are passed through as local variable rather than global
# as this (slightly) quickens the resolution process and can be more efficiently
# minified (especially when both are regularly referenced in your plugin).
# Create the defaults once