Skip to content

Instantly share code, notes, and snippets.

In order to clarify the intellectual property license granted with Contributions from any person or entity, Piotr Sarnacki, Inc. ("Piotr Sarnacki") must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license does not change your rights to use your own Contributions for any other purpose.

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to Piotr Sarnacki. Except for the license granted herein to Piotr Sarnacki and recipients of software distributed by Piotr Sarnacki, You reserve all right, title, and interest in and to Your Contributions.

Definitions. "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with Piotr Sarnacki. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that enti

@drogus
drogus / Rakefile.rb
Created July 26, 2013 10:49
This is the example contents of the Rakefile, which you would use to run active record tasks without using Rails. It assumes using the same directories as rails uses: `db/migrate`, `config/database.yml`.
require 'bundler/setup'
require 'active_record'
include ActiveRecord::Tasks
db_dir = File.expand_path('../db', __FILE__)
config_dir = File.expand_path('../config', __FILE__)
DatabaseTasks.env = ENV['ENV'] || 'development'
use crossbeam_deque::{Injector, Stealer, Worker};
use tokio::sync::Mutex;
use std::{iter, sync::Arc, time::Duration};
const NUMBER_OF_WORKERS: usize = 10;
#[derive(Debug)]
pub struct Job {}
// this is taken straight of the crossbeam::deque docs
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local opt = vim.opt -- to set options
cmd 'packadd paq-nvim' -- load the package manager
local paq = require('paq-nvim').paq -- a convenient alias
paq {'savq/paq-nvim', opt = true} -- paq-nvim manages itself
paq {'junegunn/fzf'}
paq {'junegunn/fzf.vim'} -- to enable preview (optional)
install:
- "sudo apt-get remove mysql-common mysql-server-5.5 mysql-server-core-5.5 mysql-client-5.5 mysql-client-core-5.5"
- "sudo apt-get autoremove"
- "sudo apt-get install libaio1"
- "wget -O mysql-5.6.14.deb http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14-debian6.0-x86_64.deb/from/http://cdn.mysql.com/"
- "sudo dpkg -i mysql-5.6.14.deb"
- "sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql.server"
- "sudo ln -s /opt/mysql/server-5.6/bin/* /usr/bin/"
# some config values were changed since 5.5
- "sudo sed -i'' 's/table_cache/table_open_cache/' /etc/mysql/my.cnf"
@drogus
drogus / Dockerfile
Created December 2, 2018 23:06
AWS lambda rust
FROM amazonlinux:2017.03.1.20170812-with-sources
RUN curl https://sh.rustup.rs -sSf | /bin/sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
RUN rustup install nightly
RUN yum install -y gcc gcc-c++ make openssl openssl-devel
RUN mkdir /code
WORKDIR /code
@drogus
drogus / controllers.application.js
Created February 20, 2017 10:35
router-basic-route-inheritance-exampl
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@drogus
drogus / components.xss-test.js
Last active September 29, 2017 08:27
xss-test
import Ember from 'ember';
export default Ember.Component.extend({
name: Ember.computed(function() {
return `<h1 style="color: red">pwnd</h1>`;
}),
xss: Ember.computed(function() {
return Ember.String.htmlSafe("<b>" + Ember.Handlebars.Utils.escapeExpression(this.get('name')) + "</b>");
})

Requesting a build through the API can be done by sending a POST request to a /repo/{slug|id}/requests path.

Here is script for sending minimal request to a travis-ci/travis-core repository, for a master branch:

body='{
"request": {
  "branch":"master"
}'
$ ab -c 1 -n 1000 http://127.0.0.1:3000/home
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests