Skip to content

Instantly share code, notes, and snippets.

@ray1980
ray1980 / SSH-configuration-github-gitlab.md
Created January 25, 2024 01:16 — forked from marcoandre1/SSH-configuration-github-gitlab.md
Managing SSH keys for Github and Gitlab

Managing SSH keys for Github and Gitlab

NOTICE: This guide will help you set ssh keys for GitHub and GitLab. However, this is not going to change your commit user.name or user.email. If you need to change those for specific repositories, just run the following commands while in your repository:

git config user.name "Your Name Here"
git config user.email your@email.com

For more info, see this answer. Also, keep in mind this only changes the .git folder inside your repository which never gets added/committed/pushed/uploaded.

I recently had to manage two ssh keys (one for Github and one for Gitlab). I did some research to find the best solution. I am justing putting the pieces together here.

@ray1980
ray1980 / bearer-token.php
Created March 3, 2022 12:23 — forked from wildiney/bearer-token.php
PHP - How to get and set Bearer Token
<?php
/**
* Get hearder Authorization
* */
function getAuthorizationHeader(){
$headers = null;
if (isset($_SERVER['Authorization'])) {
$headers = trim($_SERVER["Authorization"]);
}
else if (isset($_SERVER['HTTP_AUTHORIZATION'])) { //Nginx or fast CGI
@ray1980
ray1980 / wechat_bot.vbs
Created January 8, 2022 23:58 — forked from huntagain2008/wechat_bot.vbs
Windows微信桌面端定时发送消息vbs脚本
WeekStr="1,2,3,4,5"
TimeStr="08:00:00"
NameStr="好友或群的备注"
TextStr="36.1"
Function Istime(I_dayofweek,Times)'定时执行
userTime=Split(Times,":")
userHour=userTime(0)
userMinute=userTime(1)
userSecond=userTime(2)
@ray1980
ray1980 / dvr
Created December 21, 2021 00:15 — forked from aadps/dvr
IPTV预约录像脚本
#!/bin/bash
m3u="/www/1.m3u"
dvrpath="/mnt/media/"
echo -n "频道名:"
read chan
while [ -z $(cat /www/1.m3u | grep ${chan} -A 1 | head -2 | tail -1) ]; do
echo -n "无此频道,请重新输入:"
read chan
done
@ray1980
ray1980 / gist:a93427eed66289b456fddd7db6e95529
Created August 23, 2021 07:49 — forked from abdullahbutt/gist:10253010
get last word from url after a slash in php
get last word from url after a slash in php
preg_match("/[^\/]+$/", "http://www.mydomainname.com/m/groups/view/test", $matches);
$last_word = $matches[0]; // test
OR
Use basename with parse_url:
echo basename(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
@ray1980
ray1980 / wp-menu-item-name.php
Created August 13, 2021 23:24 — forked from gmaggio/wp-menu-item-name.php
[Wordpress] Get the Menu Name of the current page
<?php
/**
* Get the Menu Name of the current page
*
* $loc is the location name of the nav menu
*
* Source:
* http://wordpress.stackexchange.com/a/155833/1044
*
*/
<?php
/**
* WordPress menu cache.
*
* @package BJ\Menu
* @author bjornjohansen
* @version 0.1.0
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU General Public License version 2 (GPLv2)
*/
@ray1980
ray1980 / wp-bootstrap4.4-pagination.php
Created August 7, 2021 23:57 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*
@ray1980
ray1980 / get_post_id_by_meta_key_and_value.php
Created August 2, 2021 05:51 — forked from feedmeastraycat/get_post_id_by_meta_key_and_value.php
WordPress: Get post id by meta key and value
<?php
if (!function_exists('get_post_id_by_meta_key_and_value')) {
/**
* Get post id from meta key and value
* @param string $key
* @param mixed $value
* @return int|bool
* @author David M&aring;rtensson <david.martensson@gmail.com>
*/
function get_post_id_by_meta_key_and_value($key, $value) {
@ray1980
ray1980 / gist:9bcaee6af99eb0488f6a8fa17ae17019
Created June 1, 2021 11:36 — forked from belcherj/gist:27c2a1ef532ebf8e8a9f333c12d5bc97
Gutenberg Block Example, with everything working
/* global _, wp */
const { __ } = wp.i18n;
const {
registerBlockType,
Editable,
InspectorControls,
MediaUploadButton,
source: {
attr,