Skip to content

Instantly share code, notes, and snippets.

View progress44's full-sized avatar
Drinking coffee

Ani Sinanaj progress44

Drinking coffee
View GitHub Profile
@kopiro
kopiro / README.md
Last active September 29, 2024 13:42
Execute sudo commands asking password interactively via macOS security dialog only one time

sudoize.sh

Asks for admin privileges via macOS security dialog and writes in the /etc/sudoers file this string:

youruser ALL=(ALL) NOPASSWD:ALL

allowing you to execute next sudo commands without asking for password via terminal.

@jpriebe
jpriebe / NestedScrollViewManager.js
Last active August 15, 2021 13:23
Appcelerator Titanium code for managing scrollviews inside of scrollviews
function NestedScrollViewManager (parent_view)
{
// Appcelerator Titanium code for managing scrollviews inside of scrollviews (not true Android
// NestedScrollViews, but just a horizontal scrollview inside of a vertical scrollview).
//
// If you want to put a horizontal scrollview inside a vertical scrollview (like the Netflix app UI),
// it seems to work reasonably well on iOS. But on android, the user experience is very janky.
// Unless the user's drag movements are nearly exactly horizontal, there will be some movement of
// the parent scrollview, and then it becomes very difficult to scroll the child view. Flinging is
// almost impossible.
@lastguest
lastguest / webserv.sh
Created December 21, 2017 16:42
[BASH] HTTP Server Responder
#!/bin/bash
SERVER_PORT="${1:-8080}"
function handleRequest(){
# $METHOD = GET|POST
# $FULL_REQUEST = /query/url/complete?with=params
# $REQUEST = /query/url/complete
# render query parameters as QUERY_* environment variables
@harshvardhanmalpani
harshvardhanmalpani / createCat.php
Created October 27, 2017 08:02
How to create Magento 2 category programmatically
<?php
//creating categories in magento 2
//last verified Magento 2.2.0 27 Oct 2017
use \Magento\Framework\App\Bootstrap;
echo 'code by harshvardhanmalpani';
include('./app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
function createCategory($a='',$b=2,$c=true,$d='',$e='',$f='',$g='') {
global $objectManager;
@kopiro
kopiro / tor_exit_nodes.md
Last active October 20, 2022 13:30
ProTip: Specify country exit nodes

With TOR, you can specify the country of exit nodes to test a particular website from a specific country.

Just add these 4 lines in the torrc file.

ExitNodes {jp}
StrictNodes 1
GeoIPExcludeUnknown 1
AllowSingleHopCircuits 0
@maxivak
maxivak / readme.md
Last active April 22, 2025 03:02
Restore repo from Gitlab bundle file

Gitlab exports repositories to tar archive which contains .bundle files.

We have repo.bundle file and we want to restore files from it.

  • create bare repo from bundle file
git clone --mirror myrepo.bundle my.git
@jeffersonmartin
jeffersonmartin / composer-private-package-github-token.md
Last active February 5, 2025 18:21
Generate a GitHub Personal Access Token for Private Composer Packages

Generate a GitHub Personal Access Token for Private Composer Packages

If you're trying to load a private repository with Composer/Laravel, we'll need to generate a GitHub Personal Access Token (similar to OAuth token) to access the repository during a composer install without entering credentials.

If you have used other Github packages from {my-org} before, you may be able to skip this step.

  1. Visit https://github.com/settings/tokens.

  2. Click Generate new token.

@smithclay
smithclay / weird-lambda-binaries-recipe.md
Created July 28, 2017 02:59
Recipe for Getting Strange Binaries Running in AWS Lambda

Recipe for running strange binaries in AWS Lambda

In general, the command ldd and the environment variable LD_LINKER_PATH is your best friend when running new, untested binaries in Lambda. My process (which I want to get around to automating one day, maybe using Packer), goes like this:

  1. Run an EC2 instance with the official AWS Lambda AMI.
  2. Get binary you want to run in AWS Lambda running on the instance (either by installing from a package manager or compiling). 
  3. Run ldd -v ./the-binary. Note all of the shared libraries it requires. You’ll need to remember these.
  4. Copy the binary to your local machine. Upload the binary with your AWS Lambda function code that runs the ldd command inside the handler function using the process execution library from your language of choice. In node, this works just fine: console.log(require('child_process').execSync('ldd -v ./the-binary'))
  5. Note any shared libraries that are missing in the function output. Copy those over from the EC2 instance to a direct
@metasean
metasean / README.md
Created June 30, 2017 03:09
How to share a webpack config between next.js and Storybook
@kopiro
kopiro / sslrenewal
Last active December 13, 2017 16:03
SSL Renewal with LE using same CSR
#!/bin/bash
CONTAINER="/var/www/html"
DOMAIN="kopiro.it"
PUBLIC_DIR="$CONTAINER/public"
BACKUP_DIR="$CONTAINER/conf/backup/$(date +%s)"
mkdir -p "$BACKUP_DIR"
cp -v $CONTAINER/conf/*.pem "$BACKUP_DIR/"