Skip to content

Instantly share code, notes, and snippets.

View olucasmac's full-sized avatar
👾
Expect nothing and appreciate everything_

Lucas M. A. Costa olucasmac

👾
Expect nothing and appreciate everything_
View GitHub Profile
@vjt
vjt / copy-from-time-machine.sh
Last active June 20, 2024 15:03
Copy data from a Time Machine volume mounted on a Linux box.
#!/bin/bash
#
# Copy data from a Time Machine volume mounted on a Linux box.
#
# Usage: copy-from-time-machine.sh <source> <target>
#
# source: the source directory inside a time machine backup
# target: the target directory in which to copy the reconstructed
# directory trees. Created if it does not exists.
#
@ericclemmons
ericclemmons / functions.php
Last active June 23, 2023 01:47
Auto-activate WordPress Plugins
<?php
// Add to: path/to/wp-content/wp-themes/your-theme/functions.php
/**
* Activate required plugins
*/
include_once ( ABSPATH . 'wp-admin/includes/plugin.php' );
@Kartones
Kartones / postgres-cheatsheet.md
Last active July 18, 2024 01:24
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@nazroll
nazroll / gsutil_cron_example.sh
Last active October 13, 2022 21:20
A shell script example to run "gsutil" as a cronjob
#! /bin/bash
# Replace "/path/to/gsutil/" with the path of your gsutil installation.
PATH="$PATH":/path/to/gsutil/
# Replace "/home/username/" with the path of your home directory in Linux/Mac.
# The ".boto" file contains the settings that helps you connect to Google Cloud Storage.
export BOTO_CONFIG="/home/username/.boto"
# A simple gsutil command that returns a list of files/folders in your bucket.
@noahub
noahub / count_to_date.js
Last active September 15, 2022 20:02
Add a Countdown to a Date
<script>
countdown('06/26/2017 8:00 PM', 'timer'); //date format: mm/dd/yyyy hh:mm AM
function countdown(dt, id)
{
var end = new Date(dt);
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
@savishy
savishy / Kubernetes - Tips.md
Last active January 22, 2024 07:31
Kubernetes Cheatsheet

About kubeconfig and Sharing kubeconfigs

When you create a Google Cloud Container cluster with gcloud container clusters create it also generates a kubeconfig entry. See the output below:

Creating cluster petclinic...done.
Created [https://container.googleapis.com/v1/projects/gcloud-testing-vish/zones/asia-east1-a/clusters/petclinic].
kubeconfig entry generated for petclinic.
NAME       LOCATION      MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS
@ziguane
ziguane / unbrick-debrick-tp-link-3020-in-osx.md
Created June 25, 2018 13:13
Unbrick|Debrick TP-LINK 3020 in OS X (includes fun things like breaking warranty)
@lgg
lgg / README.md
Last active June 29, 2024 19:50
Telegram save all media from chat/user/channel

Quick tip. It is possible to download media with small python script.

Goto https://my.telegram.org and generate api id and api hash Install Telethon library with pip3 install telethon Run saveAllMedia.py (replace api_id, api_hash and username with your values).

If you need proxy install https://github.com/Anorov/PySocks pip install PySocks

This code downloads all media from the dialog with username user/chat/channel in current directory.

@marcosvpj
marcosvpj / vscode-remove-duplicate-lines.md
Last active July 17, 2024 19:08
How to remove duplicate lines in Visual Studio Code?

If the order of lines is not important##

Sort lines alphabetically, if they aren't already, and perform these steps:
(based on this related question: https://stackoverflow.com/q/1573361/3258851)

  1. Control+F

  2. Toggle "Replace mode"

  3. Toggle "Use Regular Expression" (the icon with the .* symbol)

@aymericbeaumet
aymericbeaumet / delete-likes-from-twitter.md
Last active July 15, 2024 07:27
[Recipe] Delete all your likes/favorites from Twitter

Ever wanted to delete all your likes/favorites from Twitter but only found broken/expensive tools? You are in the right place.

  1. Go to: https://twitter.com/{username}/likes
  2. Open the console and run the following JavaScript code:
setInterval(() => {
  for (const d of document.querySelectorAll('div[data-testid="unlike"]')) {
    d.click()
 }