Skip to content

Instantly share code, notes, and snippets.

View puncoz's full-sized avatar
🇳🇵
Working from home

Puncoz Nepal puncoz

🇳🇵
Working from home
View GitHub Profile
@puncoz
puncoz / arch-missing-keyring.md
Last active April 19, 2025 22:47
Arch Linux: missing keyring issue on updates

error: key "CEB167EFB5722BD6" could not be looked up remotely error: required key missing from keyring error: failed to commit transaction (unexpected error)

$ sudo pacman-key --lsign-key CEB167EFB5722BD6

if this gives error ERROR: CEB167EFB5722BD6 could not be locally signed.

$ sudo pacman-key --refresh-keys

@puncoz
puncoz / readable-number.php
Created December 16, 2017 04:37
Some functions, that help u get readable number. For example: 5145=>5,1K 3465645=>3,4M 4544353454=>4.5B 345,45=>345
<?php
function readable_number($number, $discharge = 0, $fractional = null, $fractional_count = 1)
{
$int_number = intval($number);
if($int_number > 999)
{
$num = substr($int_number, 0, strlen($int_number) - 3);
$discharge++;

Spotify Control Commands for terminal

General syntax

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.{{Command}}

Play

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play

Pause

Postgress Important commands

Restart auto-increment counter

ALTER SEQUENCE project_detail_question_category_id_seq RESTART WITH 1

@puncoz
puncoz / git-commands.md
Last active July 14, 2024 06:20
Useful git commands

Useful git commands

Get local branch count

git branch | wc -l

Delete all merged branch from local

git branch --merged | egrep -v "(^\*|master|main|dev)" | xargs git branch -d
@puncoz
puncoz / gist:22f2c52a9c506ebb50dc922bfe2b72dd
Created October 29, 2017 16:36 — forked from nostah/gist:d610459d50564c729c56
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
@puncoz
puncoz / greatest-product.php
Last active October 7, 2017 12:24
What is the greatest product of n adjacent numbers in the same direction (up, down, left, right, or diagonally) in given matrix?
<?php
/**
* 08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
* 49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
* 81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
* 52 70 95 23 04 60 11 42 69 24 68 56 01 32 56 71 37 02 36 91
* 22 31 16 71 51 67 63 89 41 92 36 54 22 40 40 28 66 33 13 80
* 24 47 32 60 99 03 45 02 44 75 33 53 78 36 84 20 35 17 12 50
* 32 98 81 28 64 23 67 10 26 38 40 67 59 54 70 66 18 38 64 70
@puncoz
puncoz / .gitlab-ci.yml
Created June 28, 2017 08:46 — forked from timilsinabishal/.gitlab-ci.yml
Gitlab CI file for continous deployment using capistrano
image: ruby:latest
before_script:
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- ssh-add <(echo -e "$SSH_PRIVATE_KEY")
- gem install capistrano
stages:
- deploy
@puncoz
puncoz / map.choropleth.nepal.R
Created April 30, 2017 13:59 — forked from anjesh/map.choropleth.nepal-updated.R
Step-by-step plotting choropleth map of Nepal
library(rgdal)
library(ggplot2)
library(dplyr)
# clone NepalMaps from https://github.com/anjesh/NepalMaps
# read shapefile
nepal.adm3.shp <- readOGR(dsn="./NepalMaps/baselayers/NPL_adm", layer="NPL_adm3", stringsAsFactors = FALSE)
# fortify shapefile data to data frame
<?php
( ! defined('BASEPATH')) OR exit('No direct script access allowed');
class Excel extends CI_Controller {
public function index() {
$this->excel_to_mysql();
}
public function excel_to_mysql() {