Skip to content

Instantly share code, notes, and snippets.

View valenso's full-sized avatar
👾
I may be slow to respond.

Valentin valenso

👾
I may be slow to respond.
View GitHub Profile
@ahmedahamid
ahmedahamid / find-median-sorted-arrays-improved-no-nullables.cs
Last active March 12, 2021 13:52
Median of Two Sorted Arrays | Improved Solution | No Nullables
public class Solution
{
public double FindMedianSortedArrays(int[] A, int[] B)
{
if (Object.ReferenceEquals(A, null) || Object.ReferenceEquals(B, null))
{
throw new ArgumentNullException();
}
int aLen = A.Length;
@dirkgroenen
dirkgroenen / gist:07c3e8e4bc7e08bc3232ae0bdd6a0ba5
Last active July 8, 2023 05:13 — forked from wrburgess/gist:5528649
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@tomysmile
tomysmile / mac-setup-redis.md
Last active March 18, 2024 22:12
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@anotheredward
anotheredward / inputvalidation.md
Last active April 11, 2019 19:35
Input Validation Cheatsheet

1 SQL Injection

  • Search the codebase for "select", see if the queries are joined together with user input by + or string interpolation eg: `Name: ${user.name}`
  • Fix: Parameterized queries or replace with ORM queries

2 Cross-site Scripting (XSS)

  • Search the codebase for "{{{", if you see anywhere where the user input is displayed inside {{{ tags, it's probably vulnerable to XSS
  • Fix: Either remove {{{ tags or add sanitization if that's not possible
  • XSS Can also occur when creating elements with Javascript
  • XSS: Try pasting in one of the below XSS polyglots, and then inspecting the response to see if any tags got through:
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@JamieMason
JamieMason / unfollow.js.md
Last active April 26, 2024 19:31
Unfollow everyone on twitter.com

Unfollow everyone on twitter.com

  1. Go to https://twitter.com/YOUR_USER_NAME/following
  2. Open the Developer Console. (COMMAND+ALT+I on Mac)
  3. Paste this into the Developer Console and run it
// Unfollow everyone on twitter.com, by Jamie Mason (https://twitter.com/fold_left)
// https://gist.github.com/JamieMason/7580315
//
@kenrett
kenrett / Selenium Cheat Sheet.md
Last active May 25, 2023 01:28
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@schickling
schickling / Rakefile
Last active January 31, 2024 23:00
Activerecord without Rails
require "active_record"
namespace :db do
db_config = YAML::load(File.open('config/database.yml'))
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'})
desc "Create the database"
task :create do
ActiveRecord::Base.establish_connection(db_config_admin)
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
// ПоПацански.cpp : Defines the entry point for the console application.
//
// #include "stdafx.h"
#define подъёбку setlocale
#define чуть_чуть 7
#define так_себе 12
#define пошло_оно_всё 120