Skip to content

Instantly share code, notes, and snippets.

@losingle
losingle / PKPass.md
Created June 17, 2023 12:32 — forked from rlanyi/PKPass.md
How to create Apple PKPass .p12 certificate using Linux

How to create Apple PKPass .p12 certificate using Linux

You don't need a Mac to do this :-)

For generating PKPass files, you'll need 4 things after this tutorial:

  • Certificate Identifier (pass.com.example.www)
  • Team Identified (Organizational Unit (OU) in the cert generated by Apple)
  • The .p12 file
  • The password for the .p12 file
@losingle
losingle / README.md
Created June 5, 2023 02:35 — forked from equivalent/README.md
Rails 7 importmaps dropzone.js direct upload ActiveStorage

This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.

Keybase proof

I hereby claim:

  • I am losingle on github.
  • I am losingle (https://keybase.io/losingle) on keybase.
  • I have a public key ASCqHuczmUzdWj6pjKw3HiUt70LcMPUV6TG5_b9jdAIOGgo

To claim this, I am signing this object:

@losingle
losingle / nginx-tuning.md
Created May 31, 2019 02:39 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@losingle
losingle / libz.sh
Created December 2, 2016 23:15 — forked from dulacp/libz.sh
Download & Compile Libz (zlib) for iOS (all architectures)
# Builds a ZLib framework for the iPhone and the iPhone Simulator.
# Creates a set of universal libraries that can be used on an iPhone and in the
# iPhone simulator. Then creates a pseudo-framework to make using libz in Xcode
# less painful.
#
# To configure the script, define:
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 8.1)
#
# Then go get the source tar.bz of the libz you want to build, shove it in the
# same directory as this script, and run "./libz.sh". Grab a cuppa. And voila.
@losingle
losingle / README.md
Created September 22, 2015 15:36 — forked from nicerobot/README.md
Mac OS X uninstall script for packaged install of node.js

To run this, you can try:

curl -ks https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh | bash

I haven't tested this script doing it this way but i run a lot of my Gists like this so maybe this one'll work too.

Alternatively,

curl -ksO https://gist.githubusercontent.com/nicerobot/2697848/raw/uninstall-node.sh

chmod +x ./uninstall-node.sh

module ApiPagination
Infinity = 1.0/0
class Range < Grape::Validations::SingleOptionValidator
def validate_param!(attr_name, params)
unless (!@required && params[attr_name].nil?) || @option.include?(params[attr_name])
throw :error, status: 400, message: "#{attr_name}: must be within #{@option}"
end
end
end
# you have ctags but it does not work...
$ ctags -R --exclude=.git --exclude=log *
ctags: illegal option -- R
usage: ctags [-BFadtuwvx] [-f tagsfile] file ...
#you need to get new ctags, i recommend homebrew but anything will work
$ brew install ctags
#alias ctags if you used homebrew
$ alias ctags="`brew --prefix`/bin/ctags"
#!/usr/bin/env ruby
# Please read http://otobrglez.opalab.com for more information about this code.
class Book < Struct.new(:title)
def words
@words ||= self.title.gsub(/[a-zA-Z]{3,}/).map(&:downcase).uniq.sort
end
@losingle
losingle / send_csv.rb
Created December 25, 2013 03:43 — forked from mimosz/send_csv.rb
# -*- encoding: utf-8 -*-
require 'csv'
require 'smsbao'
class SendCsv < Smsbao
def initialize(login, passwd)
@smser = Smsbao.new(login, passwd)
end
def import(csv_file, col_sep=',') # MAC下为;